package com.mask.jvm.c5_gc;

import java.util.ArrayList;

/**
 * Java堆内存溢出异常测试
 * -Xms20M -Xmx20M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError
 * @author hx
 * @since 2022/1/2 9:39 下午
 */

public class HeapOOM {
    static class OOMObject{

    }

    public static void main(String[] args) {
        ArrayList<OOMObject> list = new ArrayList<>();
        while (true) {
            list.add(new OOMObject());
        }
    }
}
